// Sort a strings letters.
// By DreamVB 23:56 13/10/2016

#include <iostream>

using namespace std;
using std::cout;
using std::endl;

int main(int argc, char *argv[]){
	char s0[80];
	char s1[80];
	int i = 0;
	int j = 0;
	int len = 0;

	cout << "Enter a string and I will sort the letters : ";
	//Get input from user.
	cin >> s0;

	//Get length
	len = strlen(s0);
	//Make a copy of the string.
	strcpy(s1, s0);
	//Sort the letters into s1
	for (i = 0; i < len; i++){
		for (j = i + 1; j < len; j++){
			if (s0[i] >s0[j]){
				//Swap two values.
				swap(s0[i], s0[j]);
			}
		}
	}
	//Print out the string.
	cout << s1 << " sorted is " << s0 << endl;

	system("pause");
	return 0;
}